package entities;

import java.io.Serializable;
import javax.persistence.*;

import java.math.BigDecimal;
import java.util.List;


/**
 * The persistent class for the userprofiles database table.
 * 
 */
@Entity
@Table(name="userprofiles")

@NamedQueries({

@NamedQuery(name="getUserProfile", 
		query="SELECT x FROM Userprofile x WHERE x.email=:email"),

@NamedQuery(name="getUserId", 
		query="SELECT x.userId FROM Userprofile x WHERE x.email=:email"),

				
})


@NamedNativeQuery(name="searchFriends", query="SELECT email FROM userprofiles " +
		"WHERE name REGEXP ? ",resultClass=Userprofile.class )


public class Userprofile implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="UserId", unique=true, nullable=false)
	private int userId;

	@Column(name="Age", precision=10)
	private BigDecimal age;

	@Column(name="Email", nullable=false, length=45)
	private String email;

	@Column(name="Gender", length=15)
	private String gender;

	@Column(name="LindenEuros", nullable=false, precision=10)
	private BigDecimal lindenEuros = new BigDecimal(0);

	@Column(name="Locality", length=45)
	private String locality;

	@Column(name="Name", nullable=false, length=45)
	private String name = "";

	@Column(name="Notify_Digest", nullable=false)
	private Boolean notify_Digest=false;

	@Column(name="Notify_OnChange", nullable=false)
	private Boolean notify_OnChange=true;

	//bi-directional many-to-one association to Friend
	@OneToMany(mappedBy="userprofile1")
	private List<Friend> friends1;

	//bi-directional many-to-one association to Friend
	@OneToMany(mappedBy="userprofile2")
	private List<Friend> friends2;

	//bi-directional many-to-one association to Lindenmovement
	@OneToMany(mappedBy="userprofile")
	private List<Lindenmovement> lindenmovements;

	//bi-directional many-to-one association to Login
	@OneToMany(mappedBy="userprofile")
	private List<Login> logins;

	//bi-directional many-to-one association to Messageboard
	@OneToMany(mappedBy="userprofile")
	private List<Messageboard> messageboards;

	//bi-directional many-to-one association to Usermessage
	@OneToMany(mappedBy="userprofile")
	private List<Usermessage> usermessages;

	@ManyToOne
	@JoinColumn(name="PhotoId", nullable=true)
	private Userphoto photoid;
	
	
    public Userphoto getPhotoid() {
		return photoid;
	}

	public void setPhotoid(Userphoto photoid) {
		this.photoid = photoid;
	}

	public Userprofile() {
    }

	public int getUserId() {
		return this.userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public BigDecimal getAge() {
		return this.age;
	}

	public void setAge(BigDecimal age) {
		this.age = age;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public BigDecimal getLindenEuros() {
		return this.lindenEuros;
	}

	public void setLindenEuros(BigDecimal lindenEuros) {
		this.lindenEuros = lindenEuros;
	}

	public String getLocality() {
		return this.locality;
	}

	public void setLocality(String locality) {
		this.locality = locality;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Boolean getNotify_Digest() {
		return this.notify_Digest;
	}

	public void setNotify_Digest(Boolean notify_Digest) {
		this.notify_Digest = notify_Digest;
	}

	public Boolean getNotify_OnChange() {
		return this.notify_OnChange;
	}

	public void setNotify_OnChange(Boolean notify_OnChange) {
		this.notify_OnChange = notify_OnChange;
	}

	public List<Friend> getFriends1() {
		return this.friends1;
	}

	public void setFriends1(List<Friend> friends1) {
		this.friends1 = friends1;
	}
	
	public List<Friend> getFriends2() {
		return this.friends2;
	}

	public void setFriends2(List<Friend> friends2) {
		this.friends2 = friends2;
	}
	
	public List<Lindenmovement> getLindenmovements() {
		return this.lindenmovements;
	}

	public void setLindenmovements(List<Lindenmovement> lindenmovements) {
		this.lindenmovements = lindenmovements;
	}
	
	public List<Login> getLogins() {
		return this.logins;
	}

	public void setLogins(List<Login> logins) {
		this.logins = logins;
	}
	
	public List<Messageboard> getMessageboards() {
		return this.messageboards;
	}

	public void setMessageboards(List<Messageboard> messageboards) {
		this.messageboards = messageboards;
	}
	
	public List<Usermessage> getUsermessages() {
		return this.usermessages;
	}

	public void setUsermessages(List<Usermessage> usermessages) {
		this.usermessages = usermessages;
	}
	
}